﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    internal class Program
    {
        static void Main(string[] args)
        {
            List<int> list = new List<int>(100);
            Random random = new Random();
            for (int i = 0; i < 100; i++)
            {
                list.Add(random.Next(1000));
            }
            var sum = list.Sum();
            var average = list.Average();
            var query = list.OrderBy(x => x);
            Console.WriteLine("这100个数字为:");
            for (int i = 0; i < 100; i++)
            {
                Console.WriteLine(list[i]);
            }
            Console.WriteLine("排序后为:");
            foreach (int i in query)
            {
                Console.WriteLine(i);
            }
            Console.WriteLine("平均值为:" + average);
            Console.WriteLine("和为:" + sum);
        }
    }
}
